/**
 * Copyright 2012 Alfredo "Rainbowbreeze" Morresi
 * 
 * This file is part of Eureka! project.
 * 
 * Eureka! is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * Eureka! is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with Eureka!. If not, see http://www.gnu.org/licenses/.
 */
package it.rainbowbreeze.eureka.ui;

import android.os.Bundle;
import it.rainbowbreeze.eureka.common.AppEnv;
import it.rainbowbreeze.eureka.common.LogFacility;
import it.rainbowbreeze.libs.common.RainbowResultOperation;
import it.rainbowbreeze.libs.ui.RainbowSplashScreenActivity;

/**
 * @author Alfredo "Rainbowbreeze" Morresi
 *
 */
public class SplashScreenActivity extends RainbowSplashScreenActivity {
    // ------------------------------------------ Private Fields
    private ActivityHelper mActivityHelper;

    // -------------------------------------------- Constructors

    // --------------------------------------- Public Properties

    // -------------------------------------------------- Events
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        //WARNING
        //The AppEnv lazy-loading singleton must be called at least one time before the
        // RainbowSplashScreen#onCreate is called.
        // In order to avoid problems with Robolectric, the initialization is
        // performed here
        LogFacility logFacility = AppEnv.i(getApplicationContext()).getLogFacility();
        logFacility.i(LOG_HASH, "Starting application " + AppEnv.APP_INTERNAL_NAME + " v" + AppEnv.APP_INTERNAL_VERSION);
        
        super.onCreate(savedInstanceState);    }

    // ------------------------------------------ Public Methods

    // ----------------------------------------- Private Methods
    
    @Override
    protected void additionalInitialization(Bundle savedInstanceState) {
        super.additionalInitialization(savedInstanceState);
        mActivityHelper = AppEnv.i(this).getActivityHelper();
    }
    
    /* (non-Javadoc)
     * @see it.rainbowbreeze.libs.ui.RainbowSplashScreenActivity#beginTasksCompleted(it.rainbowbreeze.libs.common.RainbowResultOperation)
     */
    @Override
    protected void beginTasksCompleted(RainbowResultOperation<Void> result) {
        mActivityHelper.openMainMap(this);
    }

    /* (non-Javadoc)
     * @see it.rainbowbreeze.libs.ui.RainbowSplashScreenActivity#beginTaskFailed(it.rainbowbreeze.libs.common.RainbowResultOperation)
     */
    @Override
    protected void beginTaskFailed(RainbowResultOperation<Void> result) {
        // TODO Auto-generated method stub

    }

    /* (non-Javadoc)
     * @see it.rainbowbreeze.libs.ui.RainbowSplashScreenActivity#getApplicationInternalName()
     */
    @Override
    protected String getApplicationInternalName() {
        return AppEnv.APP_INTERNAL_NAME;
    }

    /* (non-Javadoc)
     * @see it.rainbowbreeze.libs.ui.RainbowSplashScreenActivity#getApplicationInternalVersion()
     */
    @Override
    protected String getApplicationInternalVersion() {
        return AppEnv.APP_INTERNAL_VERSION;
    }

    /* (non-Javadoc)
     * @see it.rainbowbreeze.libs.ui.RainbowSplashScreenActivity#getEmailForLog()
     */
    @Override
    protected String getEmailForLog() {
        return AppEnv.EMAIL_FOR_ERROR_LOG;
    }

    /* (non-Javadoc)
     * @see it.rainbowbreeze.libs.ui.RainbowSplashScreenActivity#getLogTag()
     */
    @Override
    protected String getLogTag() {
        return AppEnv.LOG_TAG;
    }
}
